package com.fivium.bpd.editor;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JList;
import javax.swing.JPanel;

import com.fivium.bpd.component.BusinessProcessDefinition;
import com.fivium.bpd.editor.renderer.AssignmentCellRenderer;
import javax.swing.JScrollPane;
import javax.swing.ListSelectionModel;
import javax.swing.JTextField;
import javax.swing.JLabel;

public class AssignmentListPanel extends JPanel
{
  private JTextField textNewAssignmentName;
  /**
   * Create the panel.
   */
  public AssignmentListPanel(BusinessProcessDefinition bpd)
  {
    setLayout(new BorderLayout(0, 0));
    
    JPanel panel = new JPanel();
    add(panel, BorderLayout.SOUTH);
    panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
    
    JLabel lblTitle = new JLabel("Title:");
    panel.add(lblTitle);
    
    textNewAssignmentName = new JTextField();
    panel.add(textNewAssignmentName);
    textNewAssignmentName.setColumns(10);
    
    JButton addButton = new JButton("Add Assignment");
    panel.add(addButton);
    
    JList list = new JList(bpd.getAssignmentList());
    list.setCellRenderer(new AssignmentCellRenderer());
    
    JScrollPane scrollPane = new JScrollPane(list);
    add(scrollPane, BorderLayout.CENTER);
  }

}
